#include <QCoreApplication>
#include <QtXml>

void retriveElement(QDomElement root, QString tag, QString attr)
{
    QDomNodeList nodes = root.elementsByTagName(tag);
    qDebug() << "# nodes: " << nodes.count();
    for (int i = 0; i < nodes.count(); ++i){
        QDomNode elm = nodes.at(i);
        if (elm.isElement()){
            QDomElement e = elm.toElement();
            qDebug() << e.attribute(attr);
        }
    }
}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QDomDocument document;
    QFile file("/home/luchu/myXML.xml");
    if (!file.open(QIODevice::ReadOnly)){
        qDebug() << "Could not open file: " << file.errorString();
        return -1;
    }else{
        if (!document.setContent(&file)){
            qDebug() << "Faild to load the file for reading";
            return -1;
        }
        file.close();
    }

    QDomElement root = document.firstChildElement();
    retriveElement(root, "Drom", "Name");

    qDebug() << "Reading finished.";

    return a.exec();
}
